<?php

use common\modules\user\models\backend\User;

return [
    'modules' => [
        'audit' => [
            'class' => 'bedezign\yii2\audit\Audit',
            'controllerNamespace' => 'backend\modules\audit\controllers',
            'viewPath' => '@backend/modules/audit/views',
            'layout' => '//main',
            'ignoreActions' => [
                'debug/*',
                'audit/*',
            ],
            'accessRoles' => null, // 权限控制方面交由backend模块处理
            'userIdentifierCallback' => function ($userID) {
                /** @var User $user */
                $user = User::getDb()->cache(function () use ($userID) {
                    return User::findOne($userID);
                }, 300);
                return $user ? $user->username : $userID;
            }
        ],
    ],
];
